<template>
  <div>
    <!-- 声明式路由跳转
      <div class="bar">
      <div class="item"><router-link to="/product">商品</router-link></div>
      <div class="item"><router-link to="/category">分类</router-link></div>
      <div class="item"><router-link to="/order">订单</router-link></div>
    </div> -->
    <div class="bar">
      <div class="item" @click="go('/product')">商品</div>
      <div class="item" @click="go('/category')">分类</div>
      <div class="item" @click="go('/order')">订单</div>
    </div>
    <router-view></router-view>
  </div>
</template>

<script lang='ts' setup>
import {useRouter} from 'vue-router'
const router=useRouter()
const go=(path:string)=>{
  console.log('path',path);
  router.push(path)
  
}
</script>

<style lang='scss' scoped>
.bar{
  display: flex;
  .item{
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100px;
    height: 35px;
    background-color: #ccc;
    margin: 5px;
  }
}
</style>